package com.example.zte.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import com.example.zte.myapplication.adapter.My2Adapter;
import com.example.zte.myapplication.entity.Language;

import java.util.ArrayList;
import java.util.List;

public class LanguageActivity extends AppCompatActivity {
    //定义名字数组
   // private String[] name = {"h5", "Android", "C","Java","Python"};

    //定义头像数组
  //  private int[] icon = new int[]{R.mipmap.h5, R.mipmap.android, R.mipmap.c,R.mipmap.java,R.mipmap.python};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_language);


        ListView listView =
                (ListView) findViewById(R.id.language_lv);

        // 初始化数据
//        List<Map<String, Object>> list = new ArrayList<>(0);
//        for (int i = 0; i < name.length; i++) {
//            Map<String, Object> aa = new HashMap<>();
//            aa.put("xx1", name[i]);
//            aa.put("xx2", icon[i]);
//
//            list.add(aa);
//        }
        List<Language> list2 = new ArrayList<>();
        list2.add(new Language(R.mipmap.h5,"H5"));
        list2.add(new Language(R.mipmap.android,"Android"));
        list2.add(new Language(R.mipmap.c,"C"));
        list2.add(new Language(R.mipmap.java,"Java"));
        list2.add(new Language(R.mipmap.python,"Python"));
//        SimpleAdapter simpleAdapter = new SimpleAdapter(this, list, R.layout.list_item_language,
//                new String[]{"xx1", "xx2"},
//                new int[]{R.id.name, R.id.icon});

        //为listview设置adapter
        // listView.a
        listView.setAdapter(new My2Adapter(this,list2));

    }

}
